package com.zzyl.nursing.controller.member;

import cn.hutool.db.PageResult;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.dto.MemberProjectPageDto;
import com.zzyl.nursing.service.INursingProjectService;
import com.zzyl.nursing.service.MemberOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/member/orders/project")
public class MemberOrderController extends BaseController {
    @Autowired
    private MemberOrderService memberOrderService;
    @Autowired
    private INursingProjectService nursingProjectService;
    @GetMapping("/page")
    public TableDataInfo<List<NursingProject>> getMemberOrderList(MemberProjectPageDto memberProjectPageDto) {
        List<NursingProject> list =  memberOrderService.getPage(memberProjectPageDto);
        TableDataInfo dataTable = getDataTable(list);
        return dataTable;

    }
    @GetMapping("/{id}")
    public R<NursingProject> getProjectById(@PathVariable Long id) {
        NursingProject nursingProject = nursingProjectService.getById(id);
        return R.ok(nursingProject);
    }
}
